package org.jdu.dao.wrapper;

import org.jdu.dao.DAOService;
import org.jdu.dao.config.DbParam;
import org.jdu.dao.config.Query;
import org.jdu.exception.ServiceException;

import junit.framework.TestCase;


public class OracleBLOBWrapperTest extends TestCase {
	
	public void testWriteLob() throws ServiceException {
		DAOService dao = new DAOService();
		byte[] ch = "ciao ciao ciao".getBytes();
		String insert = "insert into PROVA_BLOB values(?,empty_blob())";
		Query prepare = new Query(insert);
		DbParam id = new DbParam();
		id.setPos(1);
		id.setValue("1");
		prepare.addParam(id);
		
		Query select = new Query();
		select.setSql("select  BLOB_COL from PROVA_BLOB where id=1 for update");
		
		Query update = new Query();
		String upd = "update PROVA_BLOB set BLOB_COL=? where id=1";
		update.setSql(upd);
		DbParam param = new DbParam();
		param.setValue(ch);
		param.setType(DbParam.BLOB);
		param.setPos(1);
		update.addParam(param);
		
		dao.insertLob(DbParam.BLOB, "arcdeter", prepare, select, update);

	}
}
